// index.js
// 获取应用实例
import { webUrl } from '../../config'
const app = getApp()
let screen_width=750
Page({
  data: {
    webViewUrl:webUrl,
    wscreenHeight: screen_width,
  },
  async onLoad(options) {
    await app.getUserInfo()
    app.globalData.appOptions = Object.assign({},app.globalData.appOptions || {},options || {})
    const url = app.getWebUrl(app.globalData.appOptions.url || '/order/view')
    this.setData({ webViewUrl: `${webUrl}${url}`})
  },
  handelPostMessage(e){
    const mList = e.detail.data || []
    const data = mList[0] || {}
    if(['wxAppletInitToken'].includes(data.messageType)){
      app.initApp()
    }else{
      app.globalData.payInfo[data.order_code] = data
    }
  },
  onShareAppMessage: function () {}
})
